{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e7f13585-46c4-4660-8b70-e6de18d121fc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "1.26.4\n",
      "Build Dependencies:\n",
      "  blas:\n",
      "    detection method: pkgconfig\n",
      "    found: true\n",
      "    include directory: C:/Anaconda/Library/include\n",
      "    lib directory: C:/Anaconda/Library/lib\n",
      "    name: mkl-sdl\n",
      "    openblas configuration: unknown\n",
      "    pc file directory: C:\\b\\abs_c1ywpu18ar\\croot\\numpy_and_numpy_base_1708638681471\\_h_env\\Library\\lib\\pkgconfig\n",
      "    version: '2023.1'\n",
      "  lapack:\n",
      "    detection method: internal\n",
      "    found: true\n",
      "    include directory: unknown\n",
      "    lib directory: unknown\n",
      "    name: dep1583119523984\n",
      "    openblas configuration: unknown\n",
      "    pc file directory: unknown\n",
      "    version: 1.26.4\n",
      "Compilers:\n",
      "  c:\n",
      "    commands: cl.exe\n",
      "    linker: link\n",
      "    name: msvc\n",
      "    version: 19.29.30154\n",
      "  c++:\n",
      "    commands: cl.exe\n",
      "    linker: link\n",
      "    name: msvc\n",
      "    version: 19.29.30154\n",
      "  cython:\n",
      "    commands: cython\n",
      "    linker: cython\n",
      "    name: cython\n",
      "    version: 3.0.8\n",
      "Machine Information:\n",
      "  build:\n",
      "    cpu: x86_64\n",
      "    endian: little\n",
      "    family: x86_64\n",
      "    system: windows\n",
      "  host:\n",
      "    cpu: x86_64\n",
      "    endian: little\n",
      "    family: x86_64\n",
      "    system: windows\n",
      "Python Information:\n",
      "  path: C:\\b\\abs_c1ywpu18ar\\croot\\numpy_and_numpy_base_1708638681471\\_h_env\\python.exe\n",
      "  version: '3.12'\n",
      "SIMD Extensions:\n",
      "  baseline:\n",
      "  - SSE\n",
      "  - SSE2\n",
      "  - SSE3\n",
      "  found:\n",
      "  - SSSE3\n",
      "  - SSE41\n",
      "  - POPCNT\n",
      "  - SSE42\n",
      "  - AVX\n",
      "  - F16C\n",
      "  - FMA3\n",
      "  - AVX2\n",
      "  not found:\n",
      "  - AVX512F\n",
      "  - AVX512CD\n",
      "  - AVX512_SKX\n",
      "  - AVX512_CLX\n",
      "  - AVX512_CNL\n",
      "  - AVX512_ICL\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "import numpy as np\n",
    "#导入numpy库并简写为 np \n",
    "print(np.__version__)\n",
    "np.show_config()\n",
    "# 打印numpy的版本和配置说明 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "130c9b1f-3f87-495e-a73c-154f1cedb3e3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#创建一个长度为10的空向量\n",
    "LXT = np.zeros(10)\n",
    "print(LXT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "d9c8f725-9f6a-4ef5-9cf1-48837d80d7c9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "800 bytes\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#找到任何一个数组的内存大小\n",
    "LXT = np.zeros((10,10))\n",
    "print(\"%d bytes\" % (LXT.size * LXT.itemsize))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "84547480-1f7c-4b28-84ac-cfb5dcc44a39",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])\n",
      "\n",
      "Add arguments element-wise.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "x1, x2 : array_like\n",
      "    The arrays to be added.\n",
      "    If ``x1.shape != x2.shape``, they must be broadcastable to a common\n",
      "    shape (which becomes the shape of the output).\n",
      "out : ndarray, None, or tuple of ndarray and None, optional\n",
      "    A location into which the result is stored. If provided, it must have\n",
      "    a shape that the inputs broadcast to. If not provided or None,\n",
      "    a freshly-allocated array is returned. A tuple (possible only as a\n",
      "    keyword argument) must have length equal to the number of outputs.\n",
      "where : array_like, optional\n",
      "    This condition is broadcast over the input. At locations where the\n",
      "    condition is True, the `out` array will be set to the ufunc result.\n",
      "    Elsewhere, the `out` array will retain its original value.\n",
      "    Note that if an uninitialized `out` array is created via the default\n",
      "    ``out=None``, locations within it where the condition is False will\n",
      "    remain uninitialized.\n",
      "**kwargs\n",
      "    For other keyword-only arguments, see the\n",
      "    :ref:`ufunc docs <ufuncs.kwargs>`.\n",
      "\n",
      "Returns\n",
      "-------\n",
      "add : ndarray or scalar\n",
      "    The sum of `x1` and `x2`, element-wise.\n",
      "    This is a scalar if both `x1` and `x2` are scalars.\n",
      "\n",
      "Notes\n",
      "-----\n",
      "Equivalent to `x1` + `x2` in terms of array broadcasting.\n",
      "\n",
      "Examples\n",
      "--------\n",
      ">>> np.add(1.0, 4.0)\n",
      "5.0\n",
      ">>> x1 = np.arange(9.0).reshape((3, 3))\n",
      ">>> x2 = np.arange(3.0)\n",
      ">>> np.add(x1, x2)\n",
      "array([[  0.,   2.,   4.],\n",
      "       [  3.,   5.,   7.],\n",
      "       [  6.,   8.,  10.]])\n",
      "\n",
      "The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays.\n",
      "\n",
      ">>> x1 = np.arange(9.0).reshape((3, 3))\n",
      ">>> x2 = np.arange(3.0)\n",
      ">>> x1 + x2\n",
      "array([[ 0.,  2.,  4.],\n",
      "       [ 3.,  5.,  7.],\n",
      "       [ 6.,  8., 10.]])\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#从命令行得到numpy中add函数的说明文档\n",
    "np.info(np.add)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "44175a7d-309b-4082-a1f4-40ef950c4db7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "[0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#创建一个长度为10并且除了第五个值为1的空向量\n",
    "LXT = np.zeros(10)\n",
    "LXT[4] = 1\n",
    "print(LXT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "18edb254-509b-45e6-bcd5-ab84848e88ab",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "[10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33\n",
      " 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49]\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#创建一个值域范围从10到49的向量\n",
    "LXT = np.arange(10,50)\n",
    "print(LXT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "e3441270-ba03-4b85-a5f8-0ce36482fade",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "[49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26\n",
      " 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2\n",
      "  1  0]\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#反转一个向量(第一个元素变为最后一个)\n",
    "LXT = np.arange(50)\n",
    "LXT = LXT[::-1]\n",
    "print(LXT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "612f8dd6-a6ff-4fe8-8db9-26e04f84833c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "(array([0, 3, 4, 5, 6, 7, 8], dtype=int64),)\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#找到数组[1,2,0,0,4,0]中非0元素的位置索引\n",
    "LXT = np.nonzero([2,0,0,4,3,2,5,4,2,0])\n",
    "print(LXT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "cdc3bee0-f576-4799-b812-0b0b85d7d66d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "[[1.85918147e-01 3.28184090e-02 4.80314205e-02 1.56507160e-01\n",
      "  8.65541265e-01 6.51662458e-01 7.42518180e-01 9.00750464e-01\n",
      "  6.82108365e-01 7.31751099e-01]\n",
      " [3.58970501e-01 7.28456788e-02 1.61312005e-01 1.18588035e-01\n",
      "  1.35079861e-01 4.89073757e-01 3.70541908e-01 8.37221083e-01\n",
      "  4.37484650e-01 8.00497180e-01]\n",
      " [9.14930425e-01 8.87338744e-01 8.51889824e-01 8.24732561e-01\n",
      "  3.67614387e-01 9.19716183e-01 9.83325172e-01 2.34896425e-01\n",
      "  4.40464094e-02 4.41800738e-01]\n",
      " [9.47915301e-01 4.81653469e-01 4.29241616e-01 8.05853503e-04\n",
      "  5.86156999e-01 1.20699927e-01 1.76446930e-01 3.35727390e-01\n",
      "  5.76705946e-01 5.34913171e-01]\n",
      " [2.97657208e-01 1.37679341e-01 5.30818400e-02 4.74880510e-01\n",
      "  2.29603882e-01 5.82170147e-03 4.60694557e-01 6.13277402e-01\n",
      "  3.18608363e-01 5.52148745e-02]\n",
      " [5.26451335e-01 2.92417383e-01 9.52591260e-01 4.95843439e-01\n",
      "  2.35078862e-01 8.74076017e-01 5.54369848e-01 1.84740517e-01\n",
      "  5.42937392e-02 7.47994962e-01]\n",
      " [3.83717835e-01 2.82057731e-01 4.00926847e-01 7.71462808e-01\n",
      "  9.08560233e-01 3.26359325e-01 8.99854237e-01 5.07854371e-01\n",
      "  2.23045138e-01 4.73785301e-03]\n",
      " [5.77818462e-01 2.46549666e-01 6.96903729e-01 1.78934894e-01\n",
      "  3.58916418e-01 7.28710595e-01 8.54761083e-01 9.14891834e-01\n",
      "  4.59759409e-01 8.98916198e-01]\n",
      " [6.47695223e-01 4.38549552e-01 8.15846792e-01 8.65306654e-01\n",
      "  5.45262616e-01 5.87940568e-01 8.31842109e-02 3.60272551e-01\n",
      "  8.50410357e-01 5.56346779e-02]\n",
      " [4.75099566e-01 5.89471813e-01 4.89663961e-01 3.60821757e-01\n",
      "  8.86755460e-01 2.69122172e-01 8.16618420e-01 5.48911276e-01\n",
      "  8.53386728e-01 7.95005571e-01]]\n",
      "0.0008058535034110026 0.9833251718600216\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#创建一个 10x10 的随机数组并找到它的最大值和最小值\n",
    "LXT = np.random.random((10,10))\n",
    "print(LXT)\n",
    "min, max = LXT.min(), LXT.max()\n",
    "print(min,max)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "3e7e5124-e908-404f-97ae-41e0330bc992",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "[8.01731450e-01 1.40160419e-01 2.48301867e-01 8.81058698e-01\n",
      " 9.28491572e-01 1.14739199e-01 9.21491723e-01 2.10441230e-01\n",
      " 6.43177217e-01 4.36079533e-01 5.66167181e-01 1.17016040e-01\n",
      " 6.60890632e-01 1.82126876e-01 9.23237835e-01 7.51773049e-01\n",
      " 4.33223777e-01 3.10390965e-01 1.12636087e-01 2.39236956e-02\n",
      " 3.26835323e-01 8.14957995e-01 6.11726670e-01 2.50497322e-01\n",
      " 2.10053749e-01 5.65773185e-01 9.14888360e-01 7.22701184e-04\n",
      " 2.09384357e-01 7.99206034e-01]\n",
      "0.47037015800405013\n"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "#创建一个长度为30的随机向量并找到它的平均值 \n",
    "LXT = np.random.random(30)\n",
    "print(LXT)\n",
    "m = LXT.mean()\n",
    "print(m)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "8ed3064b-857a-4f31-bd5d-9c6f4c416bce",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n"
     ]
    },
    {
     "ename": "ValueError",
     "evalue": "Length of values (11) does not match length of index (12)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[27], line 12\u001b[0m\n\u001b[0;32m      4\u001b[0m data_dict \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m      5\u001b[0m     \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m统计名称\u001b[39m\u001b[38;5;124m'\u001b[39m: [\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m一月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m二月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m三月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m四月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m五月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m六月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m七月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m八月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m九月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m十月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m十一月\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m十二月\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[0;32m      6\u001b[0m     \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m日均最低温(°C)\u001b[39m\u001b[38;5;124m'\u001b[39m: [\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m5\u001b[39m, \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m9\u001b[39m, \u001b[38;5;241m14\u001b[39m, \u001b[38;5;241m18\u001b[39m, \u001b[38;5;241m21\u001b[39m, \u001b[38;5;241m20\u001b[39m, \u001b[38;5;241m16\u001b[39m, \u001b[38;5;241m10\u001b[39m, \u001b[38;5;241m3\u001b[39m, \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m2\u001b[39m],\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m      9\u001b[0m     \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m平均降水天数(天)\u001b[39m\u001b[38;5;124m'\u001b[39m: [\u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m3\u001b[39m, \u001b[38;5;241m4\u001b[39m, \u001b[38;5;241m5\u001b[39m, \u001b[38;5;241m7\u001b[39m, \u001b[38;5;241m9\u001b[39m, \u001b[38;5;241m10\u001b[39m, \u001b[38;5;241m8\u001b[39m, \u001b[38;5;241m5\u001b[39m, \u001b[38;5;241m4\u001b[39m, \u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m2\u001b[39m]\n\u001b[0;32m     10\u001b[0m }\n\u001b[0;32m     11\u001b[0m \u001b[38;5;66;03m# 创建DataFrame\u001b[39;00m\n\u001b[1;32m---> 12\u001b[0m df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mDataFrame(data_dict, index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m1\u001b[39m, \u001b[38;5;241m13\u001b[39m))\n\u001b[0;32m     13\u001b[0m \u001b[38;5;66;03m# 输出DataFrame\u001b[39;00m\n\u001b[0;32m     14\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n",
      "File \u001b[1;32mC:\\Anaconda\\Lib\\site-packages\\pandas\\core\\frame.py:778\u001b[0m, in \u001b[0;36mDataFrame.__init__\u001b[1;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[0;32m    772\u001b[0m     mgr \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_mgr(\n\u001b[0;32m    773\u001b[0m         data, axes\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mindex\u001b[39m\u001b[38;5;124m\"\u001b[39m: index, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcolumns\u001b[39m\u001b[38;5;124m\"\u001b[39m: columns}, dtype\u001b[38;5;241m=\u001b[39mdtype, copy\u001b[38;5;241m=\u001b[39mcopy\n\u001b[0;32m    774\u001b[0m     )\n\u001b[0;32m    776\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, \u001b[38;5;28mdict\u001b[39m):\n\u001b[0;32m    777\u001b[0m     \u001b[38;5;66;03m# GH#38939 de facto copy defaults to False only in non-dict cases\u001b[39;00m\n\u001b[1;32m--> 778\u001b[0m     mgr \u001b[38;5;241m=\u001b[39m dict_to_mgr(data, index, columns, dtype\u001b[38;5;241m=\u001b[39mdtype, copy\u001b[38;5;241m=\u001b[39mcopy, typ\u001b[38;5;241m=\u001b[39mmanager)\n\u001b[0;32m    779\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, ma\u001b[38;5;241m.\u001b[39mMaskedArray):\n\u001b[0;32m    780\u001b[0m     \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mma\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m mrecords\n",
      "File \u001b[1;32mC:\\Anaconda\\Lib\\site-packages\\pandas\\core\\internals\\construction.py:503\u001b[0m, in \u001b[0;36mdict_to_mgr\u001b[1;34m(data, index, columns, dtype, typ, copy)\u001b[0m\n\u001b[0;32m    499\u001b[0m     \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    500\u001b[0m         \u001b[38;5;66;03m# dtype check to exclude e.g. range objects, scalars\u001b[39;00m\n\u001b[0;32m    501\u001b[0m         arrays \u001b[38;5;241m=\u001b[39m [x\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;28;01melse\u001b[39;00m x \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[1;32m--> 503\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m arrays_to_mgr(arrays, columns, index, dtype\u001b[38;5;241m=\u001b[39mdtype, typ\u001b[38;5;241m=\u001b[39mtyp, consolidate\u001b[38;5;241m=\u001b[39mcopy)\n",
      "File \u001b[1;32mC:\\Anaconda\\Lib\\site-packages\\pandas\\core\\internals\\construction.py:119\u001b[0m, in \u001b[0;36marrays_to_mgr\u001b[1;34m(arrays, columns, index, dtype, verify_integrity, typ, consolidate)\u001b[0m\n\u001b[0;32m    116\u001b[0m         index \u001b[38;5;241m=\u001b[39m ensure_index(index)\n\u001b[0;32m    118\u001b[0m     \u001b[38;5;66;03m# don't force copy because getting jammed in an ndarray anyway\u001b[39;00m\n\u001b[1;32m--> 119\u001b[0m     arrays, refs \u001b[38;5;241m=\u001b[39m _homogenize(arrays, index, dtype)\n\u001b[0;32m    120\u001b[0m     \u001b[38;5;66;03m# _homogenize ensures\u001b[39;00m\n\u001b[0;32m    121\u001b[0m     \u001b[38;5;66;03m#  - all(len(x) == len(index) for x in arrays)\u001b[39;00m\n\u001b[0;32m    122\u001b[0m     \u001b[38;5;66;03m#  - all(x.ndim == 1 for x in arrays)\u001b[39;00m\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m    125\u001b[0m \n\u001b[0;32m    126\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    127\u001b[0m     index \u001b[38;5;241m=\u001b[39m ensure_index(index)\n",
      "File \u001b[1;32mC:\\Anaconda\\Lib\\site-packages\\pandas\\core\\internals\\construction.py:630\u001b[0m, in \u001b[0;36m_homogenize\u001b[1;34m(data, index, dtype)\u001b[0m\n\u001b[0;32m    627\u001b[0m         val \u001b[38;5;241m=\u001b[39m lib\u001b[38;5;241m.\u001b[39mfast_multiget(val, oindex\u001b[38;5;241m.\u001b[39m_values, default\u001b[38;5;241m=\u001b[39mnp\u001b[38;5;241m.\u001b[39mnan)\n\u001b[0;32m    629\u001b[0m     val \u001b[38;5;241m=\u001b[39m sanitize_array(val, index, dtype\u001b[38;5;241m=\u001b[39mdtype, copy\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[1;32m--> 630\u001b[0m     com\u001b[38;5;241m.\u001b[39mrequire_length_match(val, index)\n\u001b[0;32m    631\u001b[0m     refs\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[0;32m    633\u001b[0m homogenized\u001b[38;5;241m.\u001b[39mappend(val)\n",
      "File \u001b[1;32mC:\\Anaconda\\Lib\\site-packages\\pandas\\core\\common.py:573\u001b[0m, in \u001b[0;36mrequire_length_match\u001b[1;34m(data, index)\u001b[0m\n\u001b[0;32m    569\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    570\u001b[0m \u001b[38;5;124;03mCheck the length of data matches the length of the index.\u001b[39;00m\n\u001b[0;32m    571\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    572\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(data) \u001b[38;5;241m!=\u001b[39m \u001b[38;5;28mlen\u001b[39m(index):\n\u001b[1;32m--> 573\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[0;32m    574\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLength of values \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m    575\u001b[0m         \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m(\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlen\u001b[39m(data)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m) \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m    576\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdoes not match length of index \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m    577\u001b[0m         \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m(\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlen\u001b[39m(index)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m)\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m    578\u001b[0m     )\n",
      "\u001b[1;31mValueError\u001b[0m: Length of values (11) does not match length of index (12)"
     ]
    }
   ],
   "source": [
    "print(\"信息计算221 刘显婷 224180117\")\n",
    "import pandas as pd\n",
    "# 定义数据字典\n",
    "data_dict = {\n",
    "    '统计名称': ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],\n",
    "    '日均最低温(°C)': [-5, -2, 9, 14, 18, 21, 20, 16, 10, 3, -2],\n",
    "    '日均最高温(°C)': [15, 8, 13, 20, 25, 28, 30, 30, 26, 20, 13, 7],\n",
    "    '平均降水总量(mm)': [21, 29, 46, 70, 101, 34, 56, 140, 85, 49, 29, 17],\n",
    "    '平均降水天数(天)': [2, 3, 4, 5, 7, 9, 10, 8, 5, 4, 2, 2]\n",
    "}\n",
    "# 创建DataFrame\n",
    "df = pd.DataFrame(data_dict, index=range(1, 13))\n",
    "# 输出DataFrame\n",
    "print(df)\n",
    "# 输出平均降水天数的统计信息\n",
    "print(df['平均降水天数(天)'].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "29b8ae92-7fea-4571-9ec4-d9a899351076",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
